package ch09;

class _12_StringEx4 {
	public static void main(String[] args) {
		String[] words = { new String("aaa"), new String("bbb"), new String("ccc") };

		for (int i = 0; i < words.length; i++) {
			if (words[i].equals("ccc")) 
				System.out.println("words equals().");
			if (words[i] == "ccc") 
				System.out.println("words ==.");
		}

		for (int i = 0; i < words.length; i++) 
			words[i] = words[i].intern();
		System.out.println("<< after words.intern(); >>");

		for (int i = 0; i < words.length; i++) {
			if (words[i].equals("ccc")) 
				System.out.println("words equals().");
			if (words[i] == "ccc") 
				System.out.println("words ==.");
		}
	}
}
/*
words equals().
<< after words.intern(); >>
words equals().
words ==.
*/